﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SeaBattle.Domain.Entities
{

    public class Ship
    {
        private List<ShipPart> parts = new List<ShipPart>();
        public int Id { get; set; }
        public int X { get; private set; }
        public int Y { get; private set; }

        /// <summary>
        /// Gets the parts count.
        /// </summary>
        public int PartsCount { get { return parts.Count; } }

        /// <summary>
        /// Gets the parts.
        /// </summary>
        public IList<ShipPart> Parts { get { return parts.AsReadOnly(); } }


        public void InitializeShip(int x, int y, byte partsCount)
        {

            this.X = x;
            this.Y = y;

            for (byte i = 0; i < partsCount; ++i)
            {
                parts.Add(new ShipPart(this));
            }
        }

        public Ship(int x, int y, byte partsCount)
        {
            InitializeShip(x,y, partsCount);

        }

    }
}
